package com.itheima.demo6collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo2
{
    public static void main(String[] args) {
        //Collection集合的功能
        Collection<String> c=new ArrayList<>();
        //添加元素
        c.add("hello");
        //获取元素
        System.out.println(c.contains("hello"));
        //删除元素
        c.remove("hello");
        //集合大小
        System.out.println(c.size());
        //判断集合是否为空
        System.out.println(c.isEmpty());
        //清空集合
        c.clear();
        //把集合转换为数组
        String[] arr=c.toArray(new String[0]);

    }
}
